#include "workerthread.h"
#include <QDebug>

WorkerThread::WorkerThread()
{

}

void WorkerThread::run()
{
    qDebug() << "WorkerThread started:"
             << QThread::currentThreadId();
    int i = 0 ;
    exitStop = false;
//    setTerminationEnabled(false);//禁止暴力终止

    char * buf = new char[20];
    while(i < 5 && !exitStop){
        QThread::msleep(500);
        ++i;
        qDebug()<< i;
    }
    if(exitStop){
        qDebug() <<QStringLiteral("退出标志成立退出");
    }else{
        qDebug() <<QStringLiteral("任务完成正常退出");
    }

    delete [] buf;
    qDebug() <<QStringLiteral("释放内存")
             << QThread::currentThreadId();
}
